#include"SList.h"

void test1()
{
	SListNode* n1 = (SListNode*)malloc(sizeof(SLDataType));
	assert(n1);
	SListNode* n2 = (SListNode*)malloc(sizeof(SLDataType));
	assert(n2);
	SListNode* n3 = (SListNode*)malloc(sizeof(SLDataType));
	assert(n3);
	SListNode* n4 = (SListNode*)malloc(sizeof(SLDataType));
	assert(n4);

	n1->data = 1;
	n2->data = 2;
	n3->data = 3;
	n4->data = 4;

	n1->next = n2;
	n2->next = n3;
	n3->next = n4;
	n4->next = NULL;

	SListNode* plist = n1;
	SListPrint(plist);

	SListPushBack(&plist, 5);
	SListPushBack(&plist, 6);
	SListPushBack(&plist, 7);
	SListPushBack(&plist, 8);
	SListPrint(plist);

}

void test2()
{
	SListNode* plist = NULL;
	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 4);
	SListPrint(plist);

	SListPushFont(&plist, 5);
	SListPrint(plist);

	SListPopBack(&plist);
	SListPrint(plist);

	SListPopFont(&plist);
	SListPrint(plist);

	SListNode* pos = SListFind(plist, 2);
	SListInsertAfter(&plist, pos, 6);
	SListPrint(plist);

	SListEraseAfter(&plist, pos);
	SListPrint(plist);
}
int main()
{
	test2();
	return 0;
}